package edu.nf.ch02;

import edu.nf.ch02.converter.UserConverter;
import edu.nf.ch02.entity.User;
import edu.nf.ch02.vo.UserVO;

import java.math.BigDecimal;
import java.time.LocalDate;

/**
 * @author wangl
 * @date 2025/10/23
 */
public class Main {

    public static void main(String[] args) {
        User user = new User();
        user.setName("user1");
        user.setAge(21);
        user.setCash(new BigDecimal("1000"));
        user.setBirth(LocalDate.now());

        UserVO  userVO = UserConverter.INSTANCE.toUserVO(user);
        System.out.println(userVO.getName());
        System.out.println(userVO.getAge());
        System.out.println(userVO.getCash());
        System.out.println(userVO.getBirth());

        //反向转换
        User u1 = UserConverter.INSTANCE.toUser(userVO);
        System.out.println(u1.getName());
        System.out.println(u1.getAge());
        System.out.println(u1.getCash());
        System.out.println(u1.getBirth());
                ;
    }
}